# Signed URLs in JavaScript

> Generate a signed URL with the JavaScript SDK. The URL renders a template image when someone opens it.

Canonical: https://bannerify.co/docs/sdk/js/apis/signed-url

`generateImageSignedUrl` builds a link that renders an image when someone opens it. It makes no network request: the SDK signs the URL on your machine with your API key.

## Request

<ParamField body="templateId" type="string" required>
  The template id, for example `tpl_xxx`.
</ParamField>

<ParamField body="modifications" type="Modification[]">
  The values to put into the template's layers. They travel in the URL, so keep them short. [Modifications](https://bannerify.co/docs/essentials/modifications) lists the fields each layer accepts.
</ParamField>

<ParamField body="format" type="'png' | 'jpeg' | 'webp'" default="png">
  The image format. The method throws for any other value.
</ParamField>

<ParamField body="quality" type="number">
  The encoder quality from 1 to 100, for `jpeg` and `webp`. The default is 90.
</ParamField>

<ParamField body="nocache" type="boolean" default="false">
  Skip the cache. Every request renders a new image and counts toward your quota.
</ParamField>

```ts
const url = await bannerify.generateImageSignedUrl("tpl_xxx", {
  modifications: [{ name: "headline", text: "Hello, Ada" }],
  format: "jpeg",
  quality: 80,
})
```

## Response

The method returns a string:

```text
https://api.bannerify.co/v1/templates/signedurl?apiKeyHashed=2f5a...&format=jpeg&modifications=%5B...%5D&quality=80&templateId=tpl_xxx&sign=ce2d...
```

`apiKeyHashed` tells Bannerify which key signed the URL. `sign` is an HMAC-SHA256 of the other parameters, keyed with your API key. Nobody can change the template or the modifications in a signed URL without breaking the signature, so you can put the URL in a page, an email, or a meta tag.

```html
<img src="https://api.bannerify.co/v1/templates/signedurl?..." alt="Welcome banner" />
```

Bannerify caches the rendered image for up to 7 days. [Signed URLs](https://bannerify.co/docs/essentials/signed-urls) explains caching, quota, and limits.

## Related

- [Previous: Render videos in JavaScript](https://bannerify.co/docs/sdk/js/apis/render-video)
- [Next: PHP SDK](https://bannerify.co/docs/sdk/php/overview)
- [Documentation index](https://bannerify.co/docs/llms.txt)
