A Basic Guide to Simple and Signed URLs for Image Generation

Simple and signed URLs are another way to generate Bannerbear images. In this article, learn when to use them and when to explore alternatives instead.
by Julianne Youngberg ·

Contents

    Simple and Signed URLs offer a way for users to generate images on-demand using URL parameters. They can be integrated with applications, sites, and workflows without the need for additional authentication headers or API key management, while still allowing for dynamic customization.

    Using URLs as a method for image generation has its advantages, but it's important to consider the specialized needs of your project and any required security level before making a decision. In this article, we’ll weigh the pros and cons of simple versus signed URLs and decide if your project should use them at all.

    A URL-based Approach to Image Generation

    Producing customized images with a URL instead of an API key offers many benefits in terms of flexibility, simplicity, and scalability. However, they aren’t suitable for all use cases. Understanding your use case and how a URL-based approach works is key to deciding whether or not it suits your needs.

    Sample use cases for dynamic marketing URLs

    When a simple or signed URL is accessed, the following events occur:

    1. The URL is validated
    2. The HTTP request is held open while an image is generated
    3. The image is generated synchronously and returned
    4. On subsequent requests, the generated image is served by CDN

    This process ensures that the same image isn’t generated twice, reducing infrastructure load and taking advantage of caching mechanisms. This is ideal for use cases like:

    • Personalizing user avatars
    • Creating Open Graph images
    • Visualizing data in real-time
    • Showcasing product variants

    Simple and signed URLs both contain information telling Bannerbear what modifications to make to your dynamic template—what text to put into the title field, what images to put in which container, and so on. They produce the same end results, but they have different authentication and parameter-passing mechanisms. Let’s sum up each approach:

    What are Simple URLs?

    Simple URLs generate images on-demand. When they are accessed, they signal immediate generation and retrieval. This makes them fantastic for use cases where quick, simple images are frequently needed but security is not of prime importance.

    Their addresses include an API path and multiple sets of dynamic object data in the format of layer/attribute/data.

    This is the API path used to construct every Simple URL:

    https://ondemand.bannerbear.com/simpleurl/<URL Base>/image/<Modification Value Strings>

    A simple URL might look something like this…

    https://ondemand.bannerbear.com/simpleurl/52R3X18yXwJB4GDwrV/image/title/text/OWL%20Launch%20a%20New%20Summer%20Collection%20That%20Pays%20Homage%20to%20%E2%80%9CUK%20Legends%E2%80%9D/description/text/Fashion%20collective%20OWL%20have%20launched%20their%20new%20summer%20collection,%20which%20pays%20homage%20to%20their%20very%20specific%20UK%20legends./category/text/Fashion/image_container/image_url/https://uploads-ssl.webflow.com/63182345c3c03e7c127cf844/631afd315a163029c0c1f1d4_force-majeure-00tlC0Clfrs-unsplash.jpg

    …and produce an image that looks like this:

    Simple URL generated image sample

    What are Signed URLs?

    Signed URLs are able to generate images on-demand just like simple URLs, but they are encrypted to fully disguise API keys, params, and any other details that you may want to keep private.

    Their addresses include an API path, Base64-encoded JSON array, and HMAC-calculated signature.

    This is the API path used to construct Signed URL to generate images synchronously :

    https://ondemand.bannerbear.com/signedurl/<URL Base>/image.jpg?modifications=<Modification Query String>&s=<Signature>

    A different subdomain is used to generate images asynchronously , but all other elements remain the same:

    https://cdn.bannerbear.com/signedurl/<URL Base>/image.jpg?modifications=<Modification Query String>&s=<Signature>

    A signed URL might look something like this…

    https://ondemand.bannerbear.com/signedurl/vYR1M6LyqpWVAnXbgZ/image.jpg?modifications=W3sibmFtZSI6InBob3RvIiwiaW1hZ2VfdXJsIjoiaHR0cHM6Ly93d3cuYmFubmVyYmVhci5jb20vaW1hZ2VzL2Jsb2cvcGhvdG8tMTUyNDY3ODcxNDIxMC05OTE3YTZjNjE5YzIuanBlZyJ9LHsibmFtZSI6InRpdGxlIiwidGV4dCI6IlN5bmNocm9ub3VzIEltYWdlIEdlbmVyYXRpb24ifSx7Im5hbWUiOiJyZWFkaW5nIiwidGV4dCI6IjQgbWludXRlIHJlYWQifSx7Im5hbWUiOiJhdmF0YXIiLCJpbWFnZV91cmwiOiJodHRwczovL3d3dy5iYW5uZXJiZWFyLmNvbS9pbWFnZXMvYXV0aG9yX3lvbmdmb29rLmpwZyJ9LHsibmFtZSI6Im5hbWUiLCJ0ZXh0IjoiSm9uIFlvbmdmb29rIn0seyJuYW1lIjoiZGF0ZSIsInRleHQiOiJOb3ZlbWJlciAyMDIwIn1d&s=a50398e3bf6d9fd42f6a5fe3d3dc5b730239ba35af1d3783d7023f03a47f6ef4

    …and produce an image that looks like this:

    Signed URL generated image sample

    Bear Tip 🐻: To learn more about constructing signed URLs on Bannerbear, read the documentation. Official libraries for generating these URLs are available for Ruby, Node, and PHP.

    When to Use Simple and Signed URLs to Generate Images

    Using URLs for image generation comes with a several key advantages. Implementation is simple—there’s no need to set up auth headers, nor manage too many API keys. It’s also extremely scalable and doesn’t put unnecessary load on your infrastructure—generated images are cached and served by a Content Delivery Network (CDN).

    If you’ve decided URLs fit your use case the most, the next step is to decide between using simple and signed URLs.

    Simple URLs: For Quick, Low-security Use Cases

    Simple URLs can be the best solution when you need custom images quickly but security isn’t a big factor. This method is best for use cases that require:

    • On-demand image generation
    • Minimal manipulation of input data

    But do not necessarily involve:

    • Sensitive information that can be exposed
    • High-level user permissions

    If your goal is to create quick graphics from data readily on-hand such as by customizing user avatars or showcasing product variants, simple URLs can be a great choice.

    Bannerbear uses simple URLs to power many interactive demos, such as the Open Graph Tool and Tweetagram. Input data is fetched from the source site, then a set of simple URLs are constructed to generate images based on different templates. The final images are then retrieved and served within seconds.

    Signed URLs: For Secure Generation On-the-Fly

    When you need images generated on-the-fly but security is of higher importance, signed URLs can be an option. This method is best for use cases that require:

    • On-demand image generation
    • Minimal manipulation of input data
    • Secure parameter transmission to protect sensitive information
    • Signature encryption to prevent tampering

    The increased security of signed URLs makes it the better option when you’re working with user-specific information like emails or IDs. It’s also signed using an encrypted signature, ensuring no one can tamper with your URLs.

    Signed URLs are particularly powerful when dealing with data-heavy tasks, like content or product management. Information is readily available and minimally manipulated, so involving URLs in the workflow can allow you to create assets with limitless variety.

    Alternatives to Generating with URLs

    Neither simple nor signed URLs are going to work for every use case. While they offer speed and scalability, you don’t have as much control over the finer details. If your image generation needs are more complex, such as needing to process data prior to an API request or assigning the appropriate user permissions when generating as a team, you might want to consider another method.

    Image generation methods with Bannerbear

    Technical folks usually find the REST API to suit their needs. Being able to build exactly what they want and use a secure API key is more time-consuming, but it offers much more control.

    Even if you don’t code, third-party app integration tools like Zapier and Make can help you fit image generation into a larger workflow. You can add steps that prepare and format data for use, perform different actions based on decision trees, and route graphics to dozens of destinations. And because you’re connecting Bannerbear’s capabilities using a project API key, your work remains secure.

    Summing It Up

    URLs are just another way to generate images on-demand. They’re best for scenarios where you need graphics produced quickly and your input data is straightforward.

    Simple URLs can create images on-the-fly, but keep in mind that your base URL and modifications will be visible in the address. Encrypted signatures and disguised params give signed URLs an additional level of security. But if you have more complex requirements for image generation, you may find the REST API or third-party integration tools to be more suitable.

    The good news is that Bannerbear gives you more than one way to power your image generation needs. REST API, dynamic URLs, third-party integrations—we have it all!

    About the authorJulianne Youngberg@paradoxicaljul
    Julianne is a technical content specialist fascinated with digital tools and how they can optimize our lives. She enjoys bridging product-user gaps using the power of words.

    FFmpeg Video Editing Essentials: Trimming, Merging, Subtitling, and More!

    As an open-source tool, FFmpeg provides a wide array of functions for handling media files. Let's learn how to use FFmpeg to edit videos programmatically, including trimming, merging, adding subtitles, etc.

    How to Automatically Transcribe Audio Like a Pro using AI Tools and APIs

    In this article, we will guide you on how to transcribe audio, and list several tools for doing it automatically, such as Amazon Transcribe, Google Cloud Speech-to-Text, Whisper by OpenAI, Azure AI Speech, and AssemblyAI.

    What To Know About Zapier’s New Chatbots Feature

    Chatbots play a significant role in modern business communication. Thanks to AI and other technological developments, they are easier and cheaper than ever to add into your workflow—even if you can't code. Here's what to know about Zapier's new AI-powered Chatbots product.

    Automate & Scale
    Your Marketing

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

    A Basic Guide to Simple and Signed URLs for Image Generation
    A Basic Guide to Simple and Signed URLs for Image Generation