> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.bannerify.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Signed URL

> Generate signed URLs for on-demand image generation

## GenerateImageSignedURL

Generate a signed URL that can be used to generate images on-demand without making API calls. Perfect for dynamic content in emails, web pages, and more.

```go theme={null}
func (c *BannerifyClient) GenerateImageSignedURL(
    templateID string,
    opts *CreateImageOptions,
) (string, error)
```

### Parameters

<ParamField path="templateID" type="string" required>
  The template ID (e.g., 'tpl\_xxxxxxxxx')
</ParamField>

<ParamField path="opts" type="*CreateImageOptions">
  Optional configuration

  <Expandable title="properties">
    <ParamField path="Modifications" type="[]Modification">
      Array of modifications to apply to the template
    </ParamField>

    <ParamField path="Format" type="string" default="png">
      Output format: "png", "jpeg", or "webp"
    </ParamField>

    <ParamField path="Thumbnail" type="bool" default="false">
      Generate thumbnail version
    </ParamField>
  </Expandable>
</ParamField>

### Returns

Returns a signed URL string or error.

```go theme={null}
string // e.g., "https://api.bannerify.co/v1/templates/signedurl?..."
error  // error if URL generation fails
```

## Examples

### Basic Signed URL

```go theme={null}
package main

import (
    "fmt"
    
    "github.com/bannerify/bannerify-go"
)

func main() {
    client := bannerify.NewBannerifyClient("your-api-key")
    
    signedURL, err := client.GenerateImageSignedURL("tpl_xxxxxxxxx", nil)
    if err != nil {
        panic(err)
    }
    
    fmt.Printf("<img src='%s' alt='Generated Image' />", signedURL)
}
```

### With Modifications

```go theme={null}
signedURL, err := client.GenerateImageSignedURL("tpl_xxxxxxxxx", &bannerify.CreateImageOptions{
    Modifications: []bannerify.Modification{
        {Name: "title", Text: "Dynamic Title"},
        {Name: "subtitle", Text: "Generated on the fly"},
    },
})

if err == nil {
    fmt.Printf("<img src='%s' alt='Dynamic Banner' />", signedURL)
}
```

### WebP Format

```go theme={null}
signedURL, err := client.GenerateImageSignedURL("tpl_xxxxxxxxx", &bannerify.CreateImageOptions{
    Format: "webp",
    Modifications: []bannerify.Modification{
        {Name: "title", Text: "WebP Image"},
    },
})
```

## Use Cases

### Email Campaigns

Generate personalized images in emails:

```go theme={null}
recipients := []struct {
    Name  string
    Email string
}{
    {"Alice", "alice@example.com"},
    {"Bob", "bob@example.com"},
}

for _, recipient := range recipients {
    signedURL, _ := client.GenerateImageSignedURL("tpl_email_header", &bannerify.CreateImageOptions{
        Modifications: []bannerify.Modification{
            {Name: "name", Text: fmt.Sprintf("Hi, %s!", recipient.Name)},
        },
    })
    
    html := fmt.Sprintf("<img src='%s' alt='Personalized Header' />", signedURL)
    // Send email with html
}
```

### Dynamic Open Graph Images

Generate OG images for social media sharing:

```go theme={null}
func GetOGImageURL(title, author string) string {
    client := bannerify.NewBannerifyClient("your-api-key")
    
    signedURL, err := client.GenerateImageSignedURL("tpl_og_image", &bannerify.CreateImageOptions{
        Modifications: []bannerify.Modification{
            {Name: "title", Text: title},
            {Name: "author", Text: author},
        },
    })
    
    if err != nil {
        return ""
    }
    
    return signedURL
}

// In your HTML template
ogImage := GetOGImageURL("My Blog Post", "John Doe")
// <meta property="og:image" content="{ogImage}" />
```

### Real-time Analytics Badges

```go theme={null}
import "strconv"

stats := map[string]int{
    "views":  1234,
    "likes":  567,
    "shares": 89,
}

badgeURL, _ := client.GenerateImageSignedURL("tpl_stats_badge", &bannerify.CreateImageOptions{
    Modifications: []bannerify.Modification{
        {Name: "views", Text: strconv.Itoa(stats["views"])},
        {Name: "likes", Text: strconv.Itoa(stats["likes"])},
        {Name: "shares", Text: strconv.Itoa(stats["shares"])},
    },
})

fmt.Printf("[![Stats](%s)](https://example.com)", badgeURL)
```

### User Profile Cards

```go theme={null}
func GenerateProfileCard(userID, name, avatar string) (string, error) {
    client := bannerify.NewBannerifyClient("your-api-key")
    
    return client.GenerateImageSignedURL("tpl_profile_card", &bannerify.CreateImageOptions{
        Modifications: []bannerify.Modification{
            {Name: "user_name", Text: name},
            {Name: "avatar", Src: avatar},
            {Name: "user_id", Text: userID},
        },
    })
}

profileURL, _ := GenerateProfileCard("123", "Jane Smith", "https://example.com/avatar.jpg")
```

## Benefits

1. **No API Calls** - Images are generated only when accessed
2. **CDN Caching** - Subsequent requests are served from cache
3. **Security** - URLs are signed and can't be tampered with
4. **Flexibility** - Perfect for emails, OG images, and dynamic content
5. **Cost Effective** - Only generates when actually viewed
