Get Unlimited Stock Photos in Your Automation (Pexels API for No-Coders)

Tired of static design automation?
by Bannerbear Youtube ·

Tired of static design automation? In this tutorial, we go beyond swapping out text — and show you how to pull in randomized, relevant stock photos automatically using the Pexels API, feeding them directly into your Bannerbear templates via Zapier.

What you'll learn:

• What the Pexels Image API is and why it's great for creators (free to use!)

• How to get your Pexels API key in minutes

• How to build a search request with custom filters (orientation, size, color, and more)

• How to use a JavaScript code block in Zapier to fetch a random image

• How to connect it all to a Bannerbear template for fully automated, visually varied graphics

Perfect for: social media post automation, event posters, quote graphics, certificates, and any workflow where visual variety matters.

📎 Full tutorial & sample script: https://www.bannerbear.com/blog/how-to-use-the-pexels-api-to-randomize-images-with-bannerbear/

🔔 Subscribe for more no-code automation tutorials 👍 Like if this saved you time 💬 Drop a comment with what you're building!

Note: If you need strict control over image style or brand alignment, consider building a curated stock library instead — as mentioned in the video.

Video Transcription

[00:00:00] When you're generating images at scale, design automation usually means one thing: keeping your visuals consistent while changing the text. Think ID cards, certificates, invoices. Same layout, different data. But here's where it gets interesting. What if you want variety in both? What if every time your automation runs, you get a completely different image?

That's where the Pexels API comes in. Using Pexels API, you can automatically grab relevant randomized stock photos and feed them straight into your Bannerbear templates. This means every time the automation runs, you get fresh, unique graphics without the manual work

So if you're making quote graphics, social media

[00:01:00] posters, or anything else where variety matters, let's talk about the Pexels API, then walk through how to set this all up in Zapier. Pexels Image API is a powerful tool for sourcing relevant images automatically. It gives you access to a vast library of high-quality image, and it's completely free, making it a great choice for creators on a budget, though attribution and donations are always a good idea.

The library leans more artistic. Lots of beautiful photography. You won't find icons or transparent textures here, but you'll find plenty of images that work as backgrounds and feature frames

Here's the catch: Pexels doesn't have native integrations with no-code platforms like Zapier. That means we'll need to use a script. But here's the good news, it's fairly

[00:02:00] simple code, and since we've already written it for you, you won't need to do much more than drop it into a code block with your keyword and authentication details.

Once you've got the request working, you can use the retrieved images with Banner Bear in consecutive steps for things like event announcements and quick social graphics. One caveat, this approach works best if you're flexible about the image mood and style. If you need strict control over the vibe of your images, you might be better off building your own brand kit-approved stock library and pulling from that instead.

To use the Pexels API, you'll need an API key. Not a big deal. It's free, and getting one takes just a few minutes. Head over to Pexels and log into your account. Go to their image and video API page

Click your API key to get started.

[00:03:00] You'll need to fill out a quick form. Give your project a name, your category that fits what you're building, and add any extra details about how you're planning to use it

Once you're done hit Generate API Key

That's it. You'll now have an API key ready to go. Save it somewhere safe. You'll need it in the next step. Now that you've got access to the Pexels image library, we need to prepare a request that performs a search and returns a randomized image. We'll be using JavaScript for this example. Don't worry if you're not a developer, the code is simpler than it looks, and we'll walk through it step by step.

Let's start by building the request URL. The Pexels search endpoint lets you add parameters to filter results, things like orientation,

[00:04:00] size, color, and locale. Here's what a basic request looks like You can set parameters for things like image orientation size, color, locale, and page number

If you want to add multiple parameters, just follow this format. Parameter equals value, and separate each one with an ampersand. Here are a few examples

For the full list of supported parameters check out the Pexels API documentation. In this tutorial, we're keeping it simple. We'll just specify orientation, size, and how many results to return

Now this is completely optional, but we can test the request using c URL in the terminal

[00:05:00] to make sure it's working before we move to Zapier. Watch how it's done

Great. We've confirmed the request works. Now let's move this into Zapier and connect it to your workflow. Now it's time to bring this into Zapier. The process is straightforward. Paste the script, add your authentication details, and test it. We've built a sample script for you that handles the heavy lifting and sets up your image variables, fetches an array of images from Pexels based on your parameters, and returns a single direct link for you to use.

Grab the script from the link in the video description. You can use it as exactly is or tweak the request URL to match your specific needs

Now

[00:06:00] let's switch over to Zapier. Your trigger can be anything, Airtable, a form, a webhook, whatever feeds your keyword into the workflow. And for this walkthrough, we'll keep it simple and use the static test value. You can wire up your actual trigger however works best for your use case. Let's jump to the important part, the code module.

We're using Run JavaScript in Code by Zapier

Here's what you need to do. First, set up two pieces of input data, keyword and pexels underscore API underscore key. We'll use a static keyword for testing

Paste your script into the code section

Now test the action. If everything's connected properly you should get back a link to an

[00:07:00] image that matches your search parameters

There you go. All that's left is to complete yours up. So let's walk through how you can actually use your random image in a Bannerbear template. Next step, create your image with Bannerbear. Connect your account like usual and select your template

Let's scroll down to the modification section and find the template field that you want to populate, whether it's a background, a feature image, or something else

Drop in that dynamic image link from your Pexel step and you're done

Here are a few examples using different keywords

[00:08:00]

With the addition of a relevant stock image to your Banner Bear template, you've exponentially expanded what's possible. Every automation run generates something fresh and visually distinct. This opens up plenty of possibilities. Social media posts that once felt stale are now varied and alive. Event posters actually adapt to what you're promoting and attract the eyes of passersby.

The beauty of automation isn't just about saving time. It's about doing more interesting work with less effort. So go ahead, test this method out and see what you can build. Thanks for watching.

https://youtu.be/KPyk2_caQeA?si=ikW6HuofeqOfWToW

About the authorBannerbear Youtube@bannerbear
Quick Youtube video tutorials from the Bannerbear team on automating image and video generation.
Video

3 Ways to Automatically Generate Certificates With Bannerbear

Tired of creating certificates one by one?

How to Automatically Generate Graphics from Google Maps Reviews (Make.com)

With Make, you can turn Google Maps reviews into shareable social graphics automatically. Learn how to save time and boost social proof without code!

Video

How to Generate Bannerbear Images with Public Forms (No Code)

Online image generators are convenient — but they lock you into their templates.

Automate & Scale
Your Marketing

Bannerbear helps you auto-generate social media visuals, banners and more with our API and nocode integrations

Get Unlimited Stock Photos in Your Automation (Pexels API for No-Coders)
Get Unlimited Stock Photos in Your Automation (Pexels API for No-Coders)